#!/bin/bash

# tomcat 安装

echo "start to install tomcat 8.5.16 ..."

tomcatfile=$(ls | grep apache-tomcat-8.5.16.tar.gz)

echo "准备安装tomcat服务器 ..."

if [ ! -f "$tomcatfile" ]; then
    echo "开始下载tomcat 8.5.16 安装包..."
    wget http://mirror.dsrg.utoronto.ca/apache/tomcat/tomcat-8/v8.5.16/bin/apache-tomcat-8.5.16.tar.gz
fi

tomcatfile=$(ls | grep apache-tomcat-8.5.16.tar.gz)

if [ -f "$tomcatfile" ]; then
    echo "开始解压并安装tomcat ... "
    tar -zxvf $tomcatfile -C /usr/local/
    mv /usr/local/apache-tomcat-8.5.16/ /usr/local/tomcat
    echo "install tomcat success"
fi
